import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../components/HomeView.vue'
import BookRecord from '../views/bookRecord/bookRecord.vue'
import Expense from '../views/expense/expense.vue'
import Login from '../views/login.vue'
import Register from '../views/register.vue'
import Index from '../views/index.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'HomeView',
    component: HomeView,
    redirect: '/index',
    children: [
      {
        path: '/bookRecord', 
        name: 'bookRecord',
        component: BookRecord
      },
      {
        path: '/expense', 
        name: 'expense',
        component: Expense
      },
      {
        path: '/index',
        name: 'index',
        component: Index
      },
    ]
  },
  {
    path: '/login',
    name: 'login',
    component: Login
  },
  {
    path: '/register',
    name: 'register',
    component: Register
  },
  
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
